﻿using System.Collections.Generic;

namespace Mekiasm
{
    public class MekSoundSystem
    {
        public static List<Common.SoundItem> SoundItems = new List<Common.SoundItem>();
        public static Common.SoundItem Create(string name)
        {
            Common.SoundItem soundItem = new Common.SoundItem(name);
            SoundItems.Add(soundItem);
            return soundItem;
        }
        public static void Update()
        {
            for (int i = 0; i < SoundItems.Count; i++)
            {
                Common.SoundItem soundItem = SoundItems[i];
                if (soundItem.Percent == 0f)
                {
                    soundItem.Play();
                }
                else if (soundItem.Percent == 1f)
                {
                    soundItem.Pause();
                }
                if (soundItem.IsRemove) SoundItems.RemoveAt(i);
            }

        }
        public static void Dispose()
        {
            SoundItems.Clear();
        }
    }
}
